#include <iostream>
#include <jsoncpp/json/json.h>
#include <memory>
using namespace std;

int main()
{
  string msg = R"({"name":"json", "age":18, "score":[90, 92.3, 99.9]})";

  Json::Value root;
  Json::CharReaderBuilder crb;
  unique_ptr<Json::CharReader> cr_ptr(crb.newCharReader());
  string err;
  bool ret = cr_ptr->parse(msg.c_str(), msg.c_str() + msg.size(), &root, &err);
  if(ret == false)
  {
    cout << err << endl;
  }
  cout << "name: " << root["name"] << endl;
  cout << "age: " << root["age"] << endl;
  cout << "score: ";
  for(auto& e : root["score"])
  {
    cout << e << " ";
  }
  cout << endl;
  return 0;
}
